css: Implement filter
authorBenjamin Otte <otte@redhat.com>
Sat, 31 Dec 2016 01:48:25 +0000 (02:48 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 31 Dec 2016 01:49:47 +0000 (02:49 +0100)
So far, it's only implemented for widgets, not for gadgets.

Not sure how to do it for gadgets without conflicts for widget gadgets
yet...

gtk/gtkcssstylepropertyimpl.c
gtk/gtkwidget.c

index 15ea1cac4665e30bf019f36ae6bc67589411a645..20d298818684088cd96281b09f58f6068116c022 100644 (file)
@@ -1594,6 +1594,14 @@ _gtk_css_style_property_init_properties (void)
                                           opacity_parse,
                                           opacity_query,
                                           _gtk_css_number_value_new (1, GTK_CSS_NUMBER));
+  gtk_css_style_property_register        ("filter",
+                                          GTK_CSS_PROPERTY_FILTER,
+                                          G_TYPE_NONE,
+                                          GTK_STYLE_PROPERTY_ANIMATED,
+                                          GTK_CSS_AFFECTS_REDRAW,
+                                          filter_value_parse,
+                                          NULL,
+                                          gtk_css_filter_value_new_none ());
 
   /* Private property holding the binding sets */
   gtk_css_style_property_register        ("-gtk-key-bindings",
index 04dfc04d5eeb1aa53d1a6cff264e60d43497a741..8b52b6c34877935ccfa06f0c7bf1398746ca1dfa 100644 (file)
 #include "gtkaccelmapprivate.h"
 #include "gtkaccelgroupprivate.h"
 #include "gtkclipboard.h"
-#include "gtkcssstylepropertyprivate.h"
+#include "gtkcssfiltervalueprivate.h"
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
+#include "gtkcssstylepropertyprivate.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtkselectionprivate.h"
@@ -15534,6 +15535,7 @@ gtk_widget_snapshot (GtkWidget   *widget,
 {
   GtkWidgetClass *klass = GTK_WIDGET_GET_CLASS (widget);
   graphene_rect_t bounds;
+  GtkCssValue *filter_value;
   GtkAllocation clip;
   GtkAllocation alloc;
   RenderMode mode;
@@ -15563,6 +15565,9 @@ gtk_widget_snapshot (GtkWidget   *widget,
   if (GTK_DEBUG_CHECK (SNAPSHOT))
     gtk_snapshot_push (snapshot, TRUE, "%s<%p>", gtk_widget_get_name (widget), widget);
 
+  filter_value = _gtk_style_context_peek_property (gtk_widget_get_style_context (widget), GTK_CSS_PROPERTY_FILTER);
+  gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+
   if (mode == RENDER_DRAW)
     {
       cairo_t *cr;
@@ -15599,6 +15604,8 @@ gtk_widget_snapshot (GtkWidget   *widget,
         gtk_snapshot_pop_and_append (snapshot);
     }
 
+  gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+
   if (GTK_DEBUG_CHECK (SNAPSHOT))
     gtk_snapshot_pop_and_append (snapshot);
 }